package com.ocm.core.service;

import java.util.List;
import java.util.Map;

import com.ocm.core.dto.ClassInstanceDto;
import com.ocm.core.dto.PropertyValueDto;
import com.ocm.core.dto.SecurityDto;
import com.ocm.core.dto.StorageDto;
import com.ocm.core.mapping.DTOConfiguration;
import com.ocm.core.model.ClassInstance;
import com.ocm.core.model.Files;

public interface ClassInstService {

   void createInstance(long classDefId, List<PropertyValueDto> propertiesValue);

   ClassInstance createInstance(long storage, String className, Map<String, Object> properties, List<SecurityDto> securityDtos);

   List<ClassInstanceDto> findClassInstChilds(long parentClassDefId, DTOConfiguration configuration);

   ClassInstanceDto findClassInst(long classInstId, DTOConfiguration configuration);

   boolean updateInstance(long classDefId, List<PropertyValueDto> propertiesValue);

   boolean updateInstance(long storage, String instancesUUID, Map<String, Object> properties);

   boolean checkout(long classInstId);
   
   boolean checkout(long storage, String instancesUUID);

   boolean checkin(long classDefId, List<PropertyValueDto> propertiesValue);

   boolean checkin(long storage, String instancesUUID, Map<String, Object> properties);
   
   boolean cancelCheckout(long classInstId);

   boolean cancelCheckout(long storage, String instancesUUID);

   boolean hasExist(long storage, String instancesUUID);

   boolean assignSecurity(long classInstId, List<SecurityDto> securityDtos);

   boolean updatePermission(long classInstId, long userId, int accessMask);

   boolean removeSecurity(long classInstId, long userId);

   boolean syncSecurity(long classInstId);
   
   boolean restoreCreatorSecurity(long classInstId);

   Object getPropertyValue(String classInstGUID, String propertyName, String[] filterPropertyNames, int maxItems, StorageDto storageDto);

   List<ClassInstanceDto> getHistory(long classInstId);

   Files downloadFile(long classInstId);

   Files downloadFile(String guid, String storageName, String[] propertyDefNames);

   void deleteClassInstance(long storageId, String guid);

   void deleteClassInstance(long classInstId);
}
